<?php
JunctionFileCabinet::using("Junction_Builder_Collection");
JunctionFileCabinet::using("Junction_Utils_Reflection_Facade");
JunctionFileCabinet::using("Junction_Utils_Xml_Exception");
JunctionFileCabinet::using("Junction_Utils_Xml_Handler");
JunctionFileCabinet::using("Junction_Utils_Xml_Parser");

class Junction_Builder_Handlers_Collection implements Junction_Utils_Xml_Handler {
	
	/**
	 * 
	 * @throws Junction_Utils_Xml_Exception
	 * 
	 * @return Junction_Core_Class
	 */
	public function handle(SimpleXMLElement $root) {
		$collection = Junction_Utils_Reflection_Facade::getInstance("Junction_Builder_Collection", 
				array(Junction_Utils_Xml_Parser::collectAttributes($root)));
				
		$children = Junction_Utils_Xml_Parser::parse($root);
		$collection->columns = $children->get("join");
		return $collection;
	}
}
?>